package com.solomon.travel.common.front.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.solomon.travel.common.base.controller.BaseController;
import com.solomon.travel.common.model.ApiResponse;
import com.solomon.travel.common.model.Page;
import com.solomon.travel.common.po.Scenic;
import com.solomon.travel.common.po.Shop;
import com.solomon.travel.common.service.ScenicService;
import com.solomon.travel.common.util.ConstantUtils;
import com.solomon.travel.common.util.PageUtils;

@RestController("frontScenicController")
@RequestMapping("/front/scenic")
public class ScenicController extends BaseController{
	
	@Resource
	private ScenicService scenicService;
	
	@RequestMapping("/list")
	public ApiResponse list(Integer pageIndex,Integer pageSize,Scenic scenic) {
		int scenicCount = scenicService.countBySerch(scenic);
		Page page = PageUtils.createPage(pageSize, scenicCount, pageIndex);
		List<Scenic> scenics = scenicService.listBySerch(scenic, page);
		return new ApiResponse(ConstantUtils.RESPONSE_CODE_OK, scenics,page);
	}
	
}
